<html>
<head>
<title>PHPMailer - SMTP (Gmail) basic test</title>
</head>
<body>

<?php

//error_reporting(E_ALL);
error_reporting(E_STRICT);

date_default_timezone_set('Asia/Shanghai');

require_once('class.phpmailer.php');
require_once('lib/Snoopy.class.php');
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded

$mail             = new PHPMailer();

try {
		$snoopy = new Snoopy;
		$locationurl='http://192.168.1.171/myoffice/mail/weekly.php';
		$formvars["report"] = $_POST['report'];
		$snoopy->submit($locationurl,$formvars);
		//$snoopy->fetch($locationurl); 
		$body = $snoopy->results;
	} catch (Exception $e) {
		$body = '!';
	}

//$body             = file_get_contents('weekly.php');
//$body             = eregi_replace("[\]",'',$body);

$mail->IsSMTP(); // telling the class to use SMTP
//$mail->Host       = "mail.yourdomain.com"; // SMTP server
$mail->SMTPDebug  = 2;                  // enables SMTP debug information (for testing)
$mail->CharSet = "UTF-8"; // 设置字符集编码 
$mail->Encoding = "base64";//设置文本编码方式 
                                           // 1 = errors and messages
                                           // 2 = messages only
$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->SMTPSecure = "ssl";                 // sets the prefix to the servier
$mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
$mail->Port       = 465;                   // set the SMTP port for the GMAIL server
$mail->Username   = "xuchuan@iclickpro.com";  // GMAIL username
$mail->Password   = "XXUCHUANN";            // GMAIL password

$mail->SetFrom('xuchuan@iclickpro.com', 'Xu Chuan');

$mail->AddReplyTo("xuchuan@iclickpro.com","Xu Chuan");

$mail->Subject    = "Re: Weekly Status Report [01/04/2010 - 01/08/2010] by X.C.";

//$mail->AltBody    = "欢迎使用世奇论坛（通知邮件，勿回复）"; // optional, comment out and test



$mail->MsgHTML($body);

$address = "xuchuan@iclickpro.com";
$mail->AddAddress($address, "Tech");

//$mail->AddAttachment("images/2010_01.jpg");      // attachment
//$mail->AddAttachment("images/2010_02.jpg");
//$mail->AddAttachment("images/2010_03.jpg");
//$mail->AddAttachment("images/2010_04.jpg");
//$mail->AddAttachment("images/clickpro.gif");

if(!$mail->Send()) {
  echo "Mailer Error: " . $mail->ErrorInfo;
} else {
  echo "Message sent!";
}

?>

</body>
</html>
